home *** CD-ROM | disk | FTP | other *** search
- --------------------------------------------------------------------------------
- -- Weapon Plane Strike + Projectile Plane Strike
- -- Original Carnage Contest Weapon
- -- Script by DC, September 2009, www.UnrealSoftware.de
- --------------------------------------------------------------------------------
-
- -- Setup Tables
- if cc==nil then cc={} end
- cc.planestrike={}
- cc.planestrike.planestrike={}
-
- -- Load & Prepare Ressources
- cc.planestrike.gfx_wpn=loadgfx("weapons/planestrike.png") -- Weapon Image
- setmidhandle(cc.planestrike.gfx_wpn)
- cc.planestrike.sfx_plane=loadsfx("airstrike.ogg")
-
- --------------------------------------------------------------------------------
- -- Weapon: planestrike
- --------------------------------------------------------------------------------
-
- cc.planestrike.id=addweapon("cc.planestrike","Plane Strike",cc.planestrike.gfx_wpn,0,3) -- Add Weapon (0 uses, first in round 3)
-
- function cc.planestrike.draw() -- Draw
- -- HUD Positioning
- if weapon_shots==0 then
- hudpositioning(pos_invisible)
- end
- end
-
- function cc.planestrike.attack(attack) -- Attack
- if (weapon_shots<=0) and (weapon_position==1) then
- -- No more weapon switching!
- useweapon(0)
- playsound(cc.planestrike.sfx_plane)
- weapon_shots=weapon_shots+1
- -- Attack
- pid=createprojectile(cc.planestrike.planestrike.id)
- projectiles[pid]={}
- projectiles[pid].x=weapon_x-math.sin(math.rad(135))*getmapheight()*5.0
- projectiles[pid].y=weapon_y+math.cos(math.rad(135))*getmapheight()*5.0
- projectiles[pid].sx=math.sin(math.rad(135))*32.0
- projectiles[pid].sy=-math.cos(math.rad(135))*32.0
- -- End Turn
- endturn()
- end
- end
-
- --------------------------------------------------------------------------------
- -- Projectile: planestrike
- --------------------------------------------------------------------------------
-
- cc.planestrike.planestrike.id=addprojectile("cc.planestrike.planestrike") -- Add Projectile
-
- function cc.planestrike.planestrike.draw(id) -- Draw
- -- Setup draw mode
- setblend(blend_alpha)
- setalpha(1)
- setcolor(255,255,255)
- setscale(1,1)
- setrotation(135)
- -- Draw projectile
- drawimage(cc.planestrike.gfx_wpn,projectiles[id].x,projectiles[id].y)
- end
-
- function cc.planestrike.planestrike.update(id) -- Update
- -- Particle Tail
- particle(p_smoke,projectiles[id].x+math.random(-50,50),projectiles[id].y+math.random(-50,50))
- particlespeed(math.random(-2,2)*0.1,math.random(-2,2)*0.1)
- particlefadealpha(0.05)
- particle(p_lightpuff,projectiles[id].x+math.random(-50,50),projectiles[id].y+math.random(-50,50))
- particlefadealpha(0.04)
- -- Move (in substep loop for optimal collision precision)
- msubt=math.ceil(math.max(math.abs(projectiles[id].sx),math.abs(projectiles[id].sy))/10)
- msubx=projectiles[id].sx/msubt
- msuby=projectiles[id].sy/msubt
- for i=1,msubt,1 do
- projectiles[id].x=projectiles[id].x+msubx
- projectiles[id].y=projectiles[id].y+msuby
- -- Collision / Water
- if collision(col20x20,projectiles[id].x+projectiles[pid].sx*4,projectiles[id].y+projectiles[pid].sy*4)==1 or (projectiles[id].y)>getwatery()+5 then
- -- Center
- arealdamage(projectiles[id].x,projectiles[id].y,300,250)
- terrainexplosion(projectiles[id].x,projectiles[id].y,200,1)
- -- Front
- arealdamage(projectiles[id].x+projectiles[pid].sx*9,projectiles[id].y+projectiles[pid].sy*9,150,300)
- terrainexplosion(projectiles[id].x+projectiles[pid].sx*9,projectiles[id].y+projectiles[pid].sy*9,200,1)
- -- Fire
- for a=45,360,45 do
- createobject(o_fire,projectiles[id].x+math.sin(math.rad(a))*250,projectiles[id].y-math.cos(math.rad(a))*250)
- end
- -- Free projectile
- freeprojectile(id)
- break
- end
- end
- -- Scroll to projectile
- scroll(projectiles[id].x+projectiles[pid].sx*9,projectiles[id].y+projectiles[pid].sy*9)
- end